import java.io.Serializable;
import java.util.Date;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Employee implements Serializable {

	/**
	 * Clase Que almacena los valores de un empleado determinado
	 */
	private static final long serialVersionUID = 1L;
	private int emp_no;
	private String name;
	private String lastname;
	private int profession;
	private Date date;
	private double salary;
	private double commission;
	private int dept_number;

	Employee(int emp_no, String name, String lastname, int profession,
			String sDate, double salary, double commission, int dept_number) {
		

		this.emp_no = emp_no;
		this.lastname = lastname;
		this.name = name;
		this.profession = profession;

		SimpleDateFormat formatter = new SimpleDateFormat("dd/mm/yyyy");
		try {
			this.date = formatter.parse(sDate);
		} catch (ParseException e) {
			this.date = null;
		}
		this.salary = salary;
		this.commission = commission;
		this.dept_number = dept_number;

	}

	public int getEmp_no() {
		return emp_no;
	}

	public void setEmp_no(int emp_no) {
		this.emp_no = emp_no;
	}

	public String getLastname() {
		return lastname;
	}

	public void setLastname(String lastname) {
			this.lastname = lastname;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getProfession() {
		return profession;
	}

	public void setProfession(int profession) {
		this.profession = profession;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(String sDate) {
		Date date;
		SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yy");
		try {
			date = (Date) formatter.parse(sDate);
		} catch (ParseException e) {
			date = null;
		}
		this.date = date;
	}

	public double getSalary() {
		return salary;
	}

	public void setSalary(double salary) {
		this.salary = salary;
	}

	public double getCommission() {
		return commission;
	}

	public void setCommission(double commission) {
		this.commission = commission;
	}

	public int getDept_number() {
		return dept_number;
	}

	public void setDept_number(int dept_number) {
		this.dept_number = dept_number;
	}
	
	public String toString(){
		String x = "*****************************************************";
		x += "\nNumero: "+ this.getEmp_no();
		x += "\n Nombre: "+this.getName() + " Apellido; "+this.getLastname();
		x += "\nProfesion: "+this.getProfession();
		x += "\nFecha de Ingreso: "+this.getDate();
		x += "\nSalario: "+this.getSalary();
		x += "\nComision: "+this.getCommission();
		x += "\nDepartamento: "+this.getDept_number();
		return x;
	}
}